

import 'package:flutter/material.dart';
import 'package:xim/common/util/collection.dart';

/// 分割间隙
class Gap extends StatelessWidget {

  Gap._(){}

  double horizontal = 0;
  double vertical = 0;
  List<Widget>? children;

  Gap.horizontal({super.key, double gap=3, required this.children}){
    horizontal = gap;
  }

  Gap.vertical({super.key, double gap=3, required this.children}){
    vertical = gap;
  }

  @override
  Widget build(BuildContext context) {
    var items = children??[];
    if(horizontal!=0){
      return Row(
        children: items.splitJoin(SizedBox(width: horizontal,)),
      );
    }
    return Column(
      children: items.splitJoin(SizedBox(height: vertical,)),
    );
  }

}
